#include <iostream>
#include <cmath>

using namespace std;

int main()
{
    float x[15],f[15],h,sum1,sum2,sum;
    int i,n;
    cout<<"Enter the number of intervals :";
    cin>>n;
    cout<<"Enter x and y values :";
    for(i=0;i<=n;i++)
    {
        cin>>x[i]>>f[i];
    }
    h=x[1]-x[0];
    sum1=f[0]+f[n-1];
    sum2=0;
    for(i=1;i<=n-1;i+=2)
    {
        sum1=sum1+4.0*f[i];
    }
    for(i=2;i<=n-2;i+=2)
    {
        sum2=sum2+2.0*f[i];
    }
    sum=(sum1+sum2)*h/3.0;
    cout<<"The interval="<<sum;
    cin.get();
}
